package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/shop")
@Api(tags = "营业状态")
public class UserShopController {

    @Autowired
    private RedisTemplate<String, Integer> redisTemplate;

    /**
     * 查询营业状态
     */
    @GetMapping("/status")
    @ApiOperation(value = "查询营业状态")
    public Result<Integer> getState() {
        Integer status = redisTemplate.opsForValue().get("status");
        if (status == null) status = 0;
        return Result.success(status);
    }
}
